<template>
	<!--components/drug-cell/drug-cell.wxml-->
	<view class="product-cell" @click="details">
		<view class="product-info">
			<view class="product-text-info-box">
				<text class="c333 f35">{{list.name}}{{list.rxType}}</text>
				<!-- ----------- -->
				<text class="product-info-item">{{list.spec}}</text>
				<text class="product-info-item">{{list.productionEnte}}</text>
			</view>
			<view>
				<text class="product-price">￥{{list.salePrice}}</text>
			</view>
		</view>
		<view class="btn-box">
			<view class="add-to-cart-btn" catchtap="addToCart">
				<image @click.stop="cartFun(list)" class="add-to-cart-img" src="../../static/images/add_to_cart3.png"
					mode="scaleToFill"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			list: {}
		},
		methods: {
			cartFun(list) {
				this.$emit('addCart', this.list)
			},
			details(){
				uni.navigateTo({
					url: "/page1/product/index?id=" + this.list.id
				})
			}
			
		}
	}
</script>

<style scoped>
	/* components/drug-cell/drug-cell.wxss */
	.product-cell {
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 10px;
		border-bottom: 1px solid #eaeaea;
	}

	.product-image {
		width: 60px;
		height: 60px;
		margin-right: 10px;
	}

	.product-info {
		flex: 1;
		margin-left: 40rpx;
	}

	.product-text-info-box {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.product-info-item {
		font-size: 14px;
		color: #999;
	}

	.product-price {
		font-size: 14px;
		color: #f00;
	}

	.btn-box {
		width: 50px;
		height: 40px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.add-to-cart-btn {
		/* background-color: #1AAD19; */
		color: white;
		border: none;
		padding: 5px 10px;
		border-radius: 5px;
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.add-to-cart-img {
		width: 100%;
		height: 100%;
	}
</style>